import React from 'react'
export default function withCommon(Son) {
  return class Common extends React.Component {
    state = {
      username: '',
      password: '',
      repassword: '',
    }
    handle = (name) => (e) => {
      this.setState({
        [name]: e.target.value.trim(),
      })
    }
    render() {
      // this.props => {msg: 123, xxx:1,yyy:2}
      return (
        <div>
          common
          <hr />
          <Son {...this.state} handle={this.handle} {...this.props}></Son>
        </div>
      )
    }
  }
}
